#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;

int main()
{
    string str;
    cin >> str;
    size_t pos = str.find_last_of(" ");
    size_t s = str.size() - 1;
    size_t len = s - pos;
    cout << len;
}